<!-- 两列分类商品列表 -->
<form>
    <input type="hidden" name="model_id" value="10" />
<h2 class="attr-title">两列分类商品列表</h2>
<div class="layui-form-item">
    <label class="layui-form-label sm">背景颜色</label>
    <div class="layui-input-block">
        <div class="color-wrapper">
            <input data-js="color" type="text" name="back_color" value="{$config_info.back_color|default=''}" />
        </div>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">上边距</label>
    <div class="layui-input-block">
        <div class="range-wrapper">
            <input type="range" name="padding_top" value="{$config_info.padding_top|default='0'}" onchange="$(this).next().text($(this).val())">
            <span>{$config_info.padding_top|default='0'}</span>
        </div>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">下边距</label>
    <div class="layui-input-block">
        <div class="range-wrapper">
            <input type="range" name="padding_bottom" value="{$config_info.padding_bottom|default='0'}" onchange="$(this).next().text($(this).val())">
            <span>{$config_info.padding_bottom|default='0'}</span>
        </div>
    </div>
</div>
<div class="model-item">
<div class="layui-form-item">
    <label class="layui-form-label sm">左侧背景</label>
    <div class="layui-input-block">
        <div class="uploader-wrapper">
            <div class="uploader-image-wrapper" {if !isset($config_info.back_image_l) || !$config_info.back_image_l}style="display:none" {/if}>
                                        <img class='uploader-image' src='{$config_info.back_image_l|default=""}' />
                                        <div class="iconfont uploader-image-btn" onclick="delFile($(this))">&#xe696;</div>
                                    </div>
            <div class='uploader-content' {if isset($config_info.back_image_l) && $config_info.back_image_l}style="display:none" {/if}>
                <div class="uploader-icon iconfont">&#xe6bf;</div>
                <div class="uploader-text">点击上传</div>
                <div class="uploader-notice">200×300</div>
                <input type='file' class='uploader-file' onchange='uploadFile($(this))'>
            <input type='hidden' name='back_image_l' value='{$config_info.back_image_l|default=""}'>
            </div>
            
        </div>
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">大标题</label>
    <div class="layui-input-block">
        <input type="text" name="title_big_l" value="{$config_info.title_big_l|default=''}" placeholder="请输入大标题" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">小标题</label>
    <div class="layui-input-block">
        <input type="text" name="title_small_l" value="{$config_info.title_small_l|default=''}" placeholder="请输入小标题" class="layui-input">
    </div>
</div>
<div class="layui-form-item">
    <label class="layui-form-label sm">选择分类</label>
    <div class="layui-input-block">
        <div data-js="goods_class"><div data-select></div>
            <input type="hidden" name="goods_class_1_l" data-input value="{$config_info.goods_class_1_l|default='0'}" />
            <div data-type="template" data-name="gc_id_l" data-value="{if isset($config_info['gc_id_l'])}{:json_encode($config_info['gc_id_l'])}{/if}"></div>
            <table class="dssc-default-table mb15">
                <thead>
                  <tr>
                  <th class="tl">{$Think.lang.ds_goodsclass}</th>
                  <th class="w90">{$Think.lang.ds_sort}</th>
                  </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>
</div>
<div class="model-item">
    <div class="layui-form-item">
        <label class="layui-form-label sm">右侧广告</label>
        <div class="layui-input-block">
            <div class="uploader-wrapper">
                <div class="uploader-image-wrapper" {if !isset($config_info['adv_right_l'][0]['image']) || !$config_info['adv_right_l'][0]['image']}style="display:none"{/if}>
                                        <img class='uploader-image' src='{$config_info['adv_right_l'][0]['image']|default=""}' />
                                        <div class="iconfont uploader-image-btn" onclick="delFile($(this))">&#xe696;</div>
                                    </div>
                <div class='uploader-content' {if isset($config_info['adv_right_l'][0]['image']) && $config_info['adv_right_l'][0]['image']}style="display:none"{/if}>
                    <div class="uploader-icon iconfont">&#xe6bf;</div>
                    <div class="uploader-text">点击上传</div>
                    <div class="uploader-notice">395×300</div>
                    <input type='file' class='uploader-file' onchange='uploadFile($(this))'>
                <input type='hidden' name='adv_right_l[i_0][image]' value="{$config_info['adv_right_l'][0]['image']|default=""}">
                </div>
                
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label sm">跳转页面</label>
        <div class="layui-input-block">
            <input type="text" name="adv_right_l[i_0][link]" value="" placeholder="请输入跳转页面" class="layui-input">
        </div>
    </div>
</div>
<div class="model-item">
    <div class="layui-form-item">
        <label class="layui-form-label sm">固定商品</label>
        <div class="layui-input-block">
            <div class="onoff">
                <label for="if_fixed_goods_10_l_1" class="cb-enable{if !isset($config_info.if_fixed_goods_l) || $config_info.if_fixed_goods_l==1} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').hide();$(this).parents('form').find('[data-fixed=1]').show()">{$Think.lang.ds_yes}</label>
                <label for="if_fixed_goods_10_l_0" class="cb-disable{if isset($config_info.if_fixed_goods_l) && $config_info.if_fixed_goods_l==0} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').show();$(this).parents('form').find('[data-fixed=1]').hide()">{$Think.lang.ds_no}</label>
                <input id="if_fixed_goods_10_l_1"{if !isset($config_info.if_fixed_goods_l) || $config_info.if_fixed_goods_l==1} checked="checked"{/if} name="if_fixed_goods_l" value="1" type="radio">
                <input id="if_fixed_goods_10_l_0"{if isset($config_info.if_fixed_goods_l) && $config_info.if_fixed_goods_l==0} checked="checked"{/if} name="if_fixed_goods_l" value="0" type="radio">
            </div>
        </div>
    </div>
    <div class="layui-form-item" data-fixed="1"{if isset($config_info.if_fixed_goods_l) && $config_info.if_fixed_goods_l==0} style="display:none"{/if}>
        <label class="layui-form-label sm">选择商品</label>
        <div class="layui-input-block">
            <div class="select-wrapper" data-select="goods">
                <span class="text" data-count>请选择</span>
                <span class="icon iconfont">&#xe687;</span>
            </div>
            <div data-content="goods_ids" style="display:none">
                {if isset($config_info['goods_id_l']) && !empty($config_info['goods_id_l'])}
                {foreach name='config_info.goods_id_l' item='item' key='key'}
                <input data-goods="{$key}" type="number" min="0" max="255" size="1" name="goods_id_l[{$key}][sort]" value="{$item.sort}" />
                {/foreach}
                {/if}
            </div>
        </div>
    </div>
    <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods_l) || $config_info.if_fixed_goods_l==1} style="display:none"{/if}>
        <label class="layui-form-label sm">商品分类</label>
        <div class="layui-input-block">
            <div data-js="goods_class"><div data-select></div><input type="hidden" name="goods_class_2_l" data-input value="{$config_info.goods_class_2_l|default='0'}" /></div>
        </div>
    </div>
    <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods_l) || $config_info.if_fixed_goods_l==1} style="display:none"{/if}>
        <label class="layui-form-label sm">商品排序</label>
        <div class="layui-input-block">
            <select name="goods_sort_l">
                <option value="1"{if !isset($config_info.goods_sort_l) || $config_info.goods_sort_l==1} selected="selected"{/if}>按新品</option>
                <option value="2"{if isset($config_info.goods_sort_l) && $config_info.goods_sort_l==2} selected="selected"{/if}>按热销</option>
                <option value="3"{if isset($config_info.goods_sort_l) && $config_info.goods_sort_l==3} selected="selected"{/if}>按好评</option>
            </select>
        </div>
    </div>
</div>
<div class="model-item">
    <div class="layui-form-item">
        <label class="layui-form-label sm">固定品牌</label>
        <div class="layui-input-block">
            <div class="onoff">
                <label for="if_fixed_brand_10_l_1" class="cb-enable{if !isset($config_info.if_fixed_brand_l) || $config_info.if_fixed_brand_l==1} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').hide();$(this).parents('form').find('[data-fixed=1]').show()">{$Think.lang.ds_yes}</label>
                <label for="if_fixed_brand_10_l_0" class="cb-disable{if isset($config_info.if_fixed_brand_l) && $config_info.if_fixed_brand_l==0} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').show();$(this).parents('form').find('[data-fixed=1]').hide()">{$Think.lang.ds_no}</label>
                <input id="if_fixed_brand_10_l_1"{if !isset($config_info.if_fixed_brand_l) || $config_info.if_fixed_brand_l==1} checked="checked"{/if} name="if_fixed_brand_l" value="1" type="radio">
                <input id="if_fixed_brand_10_l_0"{if isset($config_info.if_fixed_brand_l) && $config_info.if_fixed_brand_l==0} checked="checked"{/if} name="if_fixed_brand_l" value="0" type="radio">
            </div>
        </div>
    </div>
    <div class="layui-form-item" data-fixed="1"{if isset($config_info.if_fixed_brand_l) && $config_info.if_fixed_brand_l==0} style="display:none"{/if}>
        <label class="layui-form-label sm">选择品牌</label>
        <div class="layui-input-block">
            <div class="select-wrapper" data-select="brand">
                <span class="text" data-count>请选择</span>
                <span class="icon iconfont">&#xe687;</span>
            </div>
            <div data-content="brand_ids" style="display:none">
                {if isset($config_info['brand_id_l']) && !empty($config_info['brand_id_l'])}
                {foreach name='config_info.brand_id_l' item='item' key='key'}
                <input data-brand="{$key}" type="number" min="0" max="255" size="1" name="brand_id_l[{$key}][sort]" value="{$item.sort}" />
                {/foreach}
                {/if}
            </div>
        </div>
    </div>
    <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_brand_l) || $config_info.if_fixed_brand_l==1} style="display:none"{/if}>
        <label class="layui-form-label sm">商品分类</label>
        <div class="layui-input-block">
            <div data-js="goods_class"><div data-select></div><input type="hidden" name="goods_class_3_l" data-input value="{$config_info.goods_class_3_l|default='0'}" /></div>
        </div>
    </div>
</div>
<div class="model-item">
    <div class="layui-form-item">
        <label class="layui-form-label sm">左侧背景</label>
        <div class="layui-input-block">
            <div class="uploader-wrapper">
                <div class="uploader-image-wrapper" {if !isset($config_info.back_image_r) || !$config_info.back_image_r}style="display:none" {/if}>
                                            <img class='uploader-image' src='{$config_info.back_image_r|default=""}' />
                                            <div class="iconfont uploader-image-btn" onclick="delFile($(this))">&#xe696;</div>
                                        </div>
                <div class='uploader-content' {if isset($config_info.back_image_r) && $config_info.back_image_r}style="display:none" {/if}>
                    <div class="uploader-icon iconfont">&#xe6bf;</div>
                    <div class="uploader-text">点击上传</div>
                    <div class="uploader-notice">200×300</div>
                    <input type='file' class='uploader-file' onchange='uploadFile($(this))'>
                <input type='hidden' name='back_image_r' value='{$config_info.back_image_r|default=""}'>
                </div>
                
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label sm">大标题</label>
        <div class="layui-input-block">
            <input type="text" name="title_big_r" value="{$config_info.title_big_r|default=''}" placeholder="请输入大标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label sm">小标题</label>
        <div class="layui-input-block">
            <input type="text" name="title_small_r" value="{$config_info.title_small_r|default=''}" placeholder="请输入小标题" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label sm">选择分类</label>
        <div class="layui-input-block">
            <div data-js="goods_class"><div data-select></div>
                <input type="hidden" name="goods_class_1_r" data-input value="{$config_info.goods_class_1_r|default='0'}" />
                <div data-type="template" data-name="gc_id_r" data-value="{if isset($config_info['gc_id_r'])}{:json_encode($config_info['gc_id_r'])}{/if}"></div>
                <table class="dssc-default-table mb15">
                    <thead>
                      <tr>
                      <th class="tl">{$Think.lang.ds_goodsclass}</th>
                      <th class="w90">{$Think.lang.ds_sort}</th>
                      </tr>
                    </thead>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    </div>
    <div class="model-item">
        <div class="layui-form-item">
            <label class="layui-form-label sm">右侧广告</label>
            <div class="layui-input-block">
                <div class="uploader-wrapper">
                    <div class="uploader-image-wrapper" {if !isset($config_info['adv_right_r'][0]['image']) || !$config_info['adv_right_r'][0]['image']}style="display:none"{/if}>
                                        <img class='uploader-image' src='{$config_info['adv_right_r'][0]['image']|default=""}' />
                                        <div class="iconfont uploader-image-btn" onclick="delFile($(this))">&#xe696;</div>
                                    </div>
                <div class='uploader-content' {if isset($config_info['adv_right_r'][0]['image']) && $config_info['adv_right_r'][0]['image']}style="display:none"{/if}>
                    <div class="uploader-icon iconfont">&#xe6bf;</div>
                    <div class="uploader-text">点击上传</div>
                    <div class="uploader-notice">395×300</div>
                    <input type='file' class='uploader-file' onchange='uploadFile($(this))'>
                <input type='hidden' name='adv_right_r[i_0][image]' value="{$config_info['adv_right_r'][0]['image']|default=""}">
                </div>
                    
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label sm">跳转页面</label>
            <div class="layui-input-block">
                <input type="text" name="adv_right_r[i_0][link]" value="" placeholder="请输入跳转页面" class="layui-input">
            </div>
        </div>
    </div>
    <div class="model-item">
        <div class="layui-form-item">
            <label class="layui-form-label sm">固定商品</label>
            <div class="layui-input-block">
                <div class="onoff">
                    <label for="if_fixed_goods_10_r_1" class="cb-enable{if !isset($config_info.if_fixed_goods_r) || $config_info.if_fixed_goods_r==1} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').hide();$(this).parents('form').find('[data-fixed=1]').show()">{$Think.lang.ds_yes}</label>
                    <label for="if_fixed_goods_10_r_0" class="cb-disable{if isset($config_info.if_fixed_goods_r) && $config_info.if_fixed_goods_r==0} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').show();$(this).parents('form').find('[data-fixed=1]').hide()">{$Think.lang.ds_no}</label>
                    <input id="if_fixed_goods_10_r_1"{if !isset($config_info.if_fixed_goods_r) || $config_info.if_fixed_goods_r==1} checked="checked"{/if} name="if_fixed_goods_r" value="1" type="radio">
                    <input id="if_fixed_goods_10_r_0"{if isset($config_info.if_fixed_goods_r) && $config_info.if_fixed_goods_r==0} checked="checked"{/if} name="if_fixed_goods_r" value="0" type="radio">
                </div>
            </div>
        </div>
        <div class="layui-form-item" data-fixed="1"{if isset($config_info.if_fixed_goods_r) && $config_info.if_fixed_goods_r==0} style="display:none"{/if}>
            <label class="layui-form-label sm">选择商品</label>
            <div class="layui-input-block">
                <div class="select-wrapper" data-select="goods">
                    <span class="text" data-count>请选择</span>
                    <span class="icon iconfont">&#xe687;</span>
                </div>
                <div data-content="goods_ids" style="display:none">
                    {if isset($config_info['goods_id_r']) && !empty($config_info['goods_id_r'])}
                    {foreach name='config_info.goods_id_r' item='item' key='key'}
                    <input data-goods="{$key}" type="number" min="0" max="255" size="1" name="goods_id_r[{$key}][sort]" value="{$item.sort}" />
                    {/foreach}
                    {/if}
                </div>
            </div>
        </div>
        <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods_r) || $config_info.if_fixed_goods_r==1} style="display:none"{/if}>
            <label class="layui-form-label sm">商品分类</label>
            <div class="layui-input-block">
                <div data-js="goods_class"><div data-select></div><input type="hidden" name="goods_class_2_r" data-input value="{$config_info.goods_class_2_r|default='0'}" /></div>
            </div>
        </div>
        <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_goods_r) || $config_info.if_fixed_goods_r==1} style="display:none"{/if}>
            <label class="layui-form-label sm">商品排序</label>
            <div class="layui-input-block">
                <select name="goods_sort_r">
                    <option value="1"{if !isset($config_info.goods_sort_r) || $config_info.goods_sort_r==1} selected="selected"{/if}>按新品</option>
                    <option value="2"{if isset($config_info.goods_sort_r) && $config_info.goods_sort_r==2} selected="selected"{/if}>按热销</option>
                    <option value="3"{if isset($config_info.goods_sort_r) && $config_info.goods_sort_r==3} selected="selected"{/if}>按好评</option>
                </select>
            </div>
        </div>
    </div>
    <div class="model-item">
        <div class="layui-form-item">
            <label class="layui-form-label sm">固定品牌</label>
            <div class="layui-input-block">
                <div class="onoff">
                    <label for="if_fixed_brand_10_r_1" class="cb-enable{if !isset($config_info.if_fixed_brand_r) || $config_info.if_fixed_brand_r==1} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').hide();$(this).parents('form').find('[data-fixed=1]').show()">{$Think.lang.ds_yes}</label>
                    <label for="if_fixed_brand_10_r_0" class="cb-disable{if isset($config_info.if_fixed_brand_r) && $config_info.if_fixed_brand_r==0} selected{/if}" onclick="$(this).parents('form').find('[data-fixed=0]').show();$(this).parents('form').find('[data-fixed=1]').hide()">{$Think.lang.ds_no}</label>
                    <input id="if_fixed_brand_10_r_1"{if !isset($config_info.if_fixed_brand_r) || $config_info.if_fixed_brand_r==1} checked="checked"{/if} name="if_fixed_brand_r" value="1" type="radio">
                    <input id="if_fixed_brand_10_r_0"{if isset($config_info.if_fixed_brand_r) && $config_info.if_fixed_brand_r==0} checked="checked"{/if} name="if_fixed_brand_r" value="0" type="radio">
                </div>
            </div>
        </div>
        <div class="layui-form-item" data-fixed="1"{if isset($config_info.if_fixed_brand_r) && $config_info.if_fixed_brand_r==0} style="display:none"{/if}>
            <label class="layui-form-label sm">选择品牌</label>
            <div class="layui-input-block">
                <div class="select-wrapper" data-select="brand">
                    <span class="text" data-count>请选择</span>
                    <span class="icon iconfont">&#xe687;</span>
                </div>
                <div data-content="brand_ids" style="display:none">
                    {if isset($config_info['brand_id_r']) && !empty($config_info['brand_id_r'])}
                    {foreach name='config_info.brand_id_r' item='item' key='key'}
                    <input data-brand="{$key}" type="number" min="0" max="255" size="1" name="brand_id_r[{$key}][sort]" value="{$item.sort}" />
                    {/foreach}
                    {/if}
                </div>
            </div>
        </div>
        <div class="layui-form-item" data-fixed="0"{if !isset($config_info.if_fixed_brand_r) || $config_info.if_fixed_brand_r==1} style="display:none"{/if}>
            <label class="layui-form-label sm">商品分类</label>
            <div class="layui-input-block">
                <div data-js="goods_class"><div data-select></div><input type="hidden" name="goods_class_3_r" data-input value="{$config_info.goods_class_3_r|default='0'}" /></div>
            </div>
        </div>
    </div>
</form>
<script>
    if(typeof(loadConfig10)=='undefined'){
        function loadConfig10(obj){
            obj.find('[data-js="color"]').colorpicker({showOn: 'both'});
            var id=obj.attr('data-id')
            var i=0
            obj.find('[data-js="goods_class"]').each(function(){
                $(this).attr('id','goods_class_'+i+'_'+id)
            
                var gc_id=parseInt($('#goods_class_'+i+'_'+id).find('*[data-input]').val())
                if(gc_id){
                    getGoodsClass(gc_id,'goods_class_'+i+'_'+id)
                }else{
                    loadGoodsClass(1,0,'goods_class_'+i+'_'+id)
                }
                i++
            })
            var i=0
            obj.find('[data-select="goods"]').each(function(){
                $(this).attr('id','select_goods_'+i+'_'+id)
                i++
            })
            obj.find('*[data-select="goods"]').click(function(){
                var goods_id=''
                $(this).parent().find('*[data-content="goods_ids"] input').each(function(){
                    goods_id+='&goods_id['+$(this).attr('data-goods')+'][sort]='+$(this).val()
                })
                dsLayerOpen('{:url(request()->controller()."/search_goods")}?id='+$(this).attr('id')+goods_id,'选择商品')
            })
            var i=0
            obj.find('[data-select="brand"]').each(function(){
                $(this).attr('id','select_brand_'+i+'_'+id)
                i++
            })
            obj.find('*[data-select="brand"]').click(function(){
                var brand_id=''
                $(this).parent().find('*[data-content="brand_ids"] input').each(function(){
                    brand_id+='&brand_id['+$(this).attr('data-brand')+'][sort]='+$(this).val()
                })
                dsLayerOpen('{:url(request()->controller()."/search_brand")}?id='+$(this).attr('id')+brand_id,'选择品牌')
            })
            obj.find('.onoff').each(function(){
                        $(this).find(".cb-enable").click(function() {
                            var parent = $(this).parents('.onoff');
                            $('.cb-disable', parent).removeClass('selected');
                            $(this).addClass('selected');
                            $('.checkbox', parent).prop('checked', true);
                        });
                        $(this).find(".cb-disable").click(function() {
                            var parent = $(this).parents('.onoff');
                            $('.cb-enable', parent).removeClass('selected');
                            $(this).addClass('selected');
                            $('.checkbox', parent).prop('checked', false);
                        });
                    })
        }
    }
    if(typeof(saveGoods)=='undefined'){
        function saveGoods(html,id,count){
            $('#'+id).parent().find('[data-content="goods_ids"]').html(html)
            $('#'+id).parent().find('[data-count]').text(count?('已选择'+count+'个'):'请选择')
            $('#'+id).parents('form').change()
        }
    }
    if(typeof(saveBrand)=='undefined'){
        function saveBrand(html,id,count){
            $('#'+id).parent().find('[data-content="brand_ids"]').html(html)
            $('#'+id).parent().find('[data-count]').text(count?('已选择'+count+'个'):'请选择')
            $('#'+id).parents('form').change()
        }
    }
</script>